<template>
  <div class="app-container">
         <el-table v-loading="loading" :data="list" >
          <el-table-column label="姓名" align="center" prop="name" />
          <el-table-column label="客户名称" align="center" prop="customerName">
             <template slot-scope="scope">
                <el-link @click="openCustomer(scope.row)" :underline="false" type="primary" >{{scope.row.customerName}}</el-link>
              </template>
          </el-table-column>
          <el-table-column label="手机" align="center" prop="mobile" />
          <el-table-column label="电话" align="center" prop="telephone" />
          <el-table-column label="邮箱" align="center" prop="email" />
          <el-table-column label="部门" align="center" prop="dept" />
          <el-table-column label="职务" align="center" prop="post" />
          <el-table-column label="创建时间" align="center" prop="createTime" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="最后一次更新时间" align="center" prop="lastTime" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.lastTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
            </template>
          </el-table-column>
          </el-table>
            <pagination
              v-show="total>0"
              :total="total"
              :page.sync="queryParams.pageNum"
              :limit.sync="queryParams.pageSize"
              @pagination="getList"
            />
    
  </div>
</template>

<script>

import { getNewContacts } from "@/api/crm/customerContacts";

export default {
  name: "customer",
  data() {
    return {
      
      // 遮罩层
      loading: true,
      list: [],
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },

    };
  },
  created() {
  },
  mounted() {
   
  },
  methods: {
    openCustomer(row){
      const customerId = row.customerId || this.ids
      this.$emit('open-customer',customerId);
      
    },
    getList(data) {
      this.loading = true;
      this.queryParams.type=data.type;
      this.queryParams.userIds=data.userIds;
      this.queryParams.deptId=data.deptId;
      getNewContacts(this.queryParams).then(response => {
        this.list = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    
   
    
  }
};
</script>
<style scoped>
 
</style>

